//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_endswith.sqf"
#include "x_setup.sqf"

private ["_instr", "_test", "_instr_ar", "_test_ar", "_c_instr_ar", "_c_test_ar", "_found", "_c"];
PARAMS_2(_instr,_test);

if (_test == "") exitWith {false};

_instr_ar = toArray(toLower _instr);
_test_ar = toArray(toLower _test);
_c_instr_ar = count _instr_ar;
_c_test_ar = count _test_ar;

if (_c_test_ar > _c_instr_ar) exitWith {false};

_c = _c_instr_ar - 1;
_found = true;
for "_i" from (_c_test_ar - 1) to 0 step -1 do {
	if (_instr_ar select _c != _test_ar select _i) exitWith {
		_found = false;
	};
	__DEC(_c);
};
_found